package com.cmfi.dao.userRoleAuthDao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.cmfi.domain.userRoleAuthEntity.Role;


// TODO 添加@Mapper
@Mapper
public interface RoleDao {

	@Select("select * from tbl_role where id = #{id} limit 1")
	public Role getRoleById(Long id);
	
	@Select("select * from tbl_role where roleName = #{roleName} limit 1")
	public Role getRoleByName(String name);
	
	@Select("select * from tbl_role")
	public List<Role> getAllRoles();

	@Insert("insert into tbl_role(id,roleName,description) values(#{id},#{roleName},#{description})")
	public int saveRole(Role user);
	
	@Delete("delete from tbl_role where id = #{id}")
    void deleteById(Long id);
}
